package com.shuwen.gcdj.common.enums;

import com.shuwen.gcdj.bean.common.response.IntegerStringKvItemResp;

import java.util.ArrayList;
import java.util.List;

/**
 * 信息范围枚举
 */
public enum InfoLevel {
    INFO_LEVEL_COMMON(1, "通用信息"),
    INFO_LEVEL_SECRET(2, "敏感信息"),
    INFO_LEVEL_BUSINESS(4, "商务信息");

    private final Integer infoLevel;

    private final String levelName;

    InfoLevel(Integer infoLevel, String levelName) {
        this.infoLevel = infoLevel;
        this.levelName = levelName;
    }

    public String getLevelName() {
        return this.levelName;
    }

    public Integer getInfoLevel() {
        return this.infoLevel;
    }

    public static List<IntegerStringKvItemResp> getKvMap(InfoLevel... levels) {
        List<IntegerStringKvItemResp> res = new ArrayList<>(levels.length);
        for (InfoLevel level : levels) {
            IntegerStringKvItemResp kv = new IntegerStringKvItemResp();
            kv.setKey(level.getInfoLevel());
            kv.setValue(level.getLevelName());
            res.add(kv);
        }
        return res;
    }
}
